import React from 'react';
import {WeaSearchGroup, WeaFormItem, WeaInput} from 'ecCom';
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
import EType from './base/EType';
import ETitle from './base/ETitle';

// 便签元素
export default class Content_scratchpad extends React.Component {
    state = {
        eNoteSetting: this.props.eNoteSetting
    };

    render() {
        const {eNoteSetting} = this.state;

        let ENoteSetting = <div></div>;
        if (this.props.eShareLevel == '2') {
            ENoteSetting = (
                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@4zeagq`} label={getLabel(33549, '显示设置')} labelCol={{span: 6}} wrapperCol={{span: 16}}>
                    <span>{getLabel(386530, '高度：')}</span>
                    <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@zhjys7`} value={eNoteSetting.height} style={{width: '50px'}} onChange={value => this.setState({eNoteSetting: {...eNoteSetting, height: value}})}/>
                </WeaFormItem>
            );
        }

        return (
            <div>
                <WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@msdjxg`} title={getLabel(81711, '基本信息')} needTigger={true} showGroup={true}>
                    <EType ecId={`${this && this.props && this.props.ecId || ''}_EType@chbe3e`} ref="eType" value={this.props.eBaseName}/>
                    {this.props.eShareLevel == '2' ? <ETitle ecId={`${this && this.props && this.props.ecId || ''}_ETitle@qkjvtl`} ref="eTitle" eid={this.props.eid} value={this.props.eTitle} {...this.props}/> : ''}
                    {ENoteSetting}
                </WeaSearchGroup>
            </div>
        );
    }

    getSaveValues() {
        return {
            eContentTitle: this.refs['eTitle'] ? this.refs['eTitle'].getSaveValues() : this.props.eTitle,
            eContentNoteHeight: this.state.eNoteSetting.height
        };
    }
}